#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;                              
struct stuType
{
      char *name;
      float score;
};
stuType student[3];

//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{

}
//---------------------------------------------------------------------------

void __fastcall TForm1::FormCreate(TObject *Sender)
{
    student[0].name = "޼";
    student[0].score = 98.8;
    student[1].name = "Ŵɽ";
    student[1].score = 90.0;
    student[2].name = "";
    student[2].score = 79.8;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
    float score;
    int grade;
    if(Edit1->Text==student[0].name) score = student[0].score;
    else if(Edit1->Text==student[1].name) score = student[1].score;
    else if(Edit1->Text==student[2].name) score = student[2].score;
    else {Label3->Caption = "ûѧ"; return;}
    grade = score/10;
    switch(grade)
    {
        case 0:
        case 1:
        case 2:
        case 3:
        case 4:
        case 5: Label3->Caption = ""; break;
        case 6: Label3->Caption = "";   break;
        case 7: Label3->Caption = "еȣ";   break;
        case 8: Label3->Caption = "ã";   break;
        case 9: Label3->Caption = "㣡";   break;
        case 10: Label3->Caption = "㣡";  break;
        default: Label3->Caption = "ɼ";   
    }
}
//---------------------------------------------------------------------------
